package cn.cloud9.designpattern.dp10adapter.object_style;

import cn.cloud9.designpattern.dp10adapter.class_style.AC220;
import cn.cloud9.designpattern.dp10adapter.class_style.DC5;

/**
 * @projectName: Java
 * @author: 戴知舟
 * @date: 2022年05月25日 10:54
 * @version: 1.0
 */
public class PowerAdapter  implements DC5 {

    private AC220 ac220;

    public PowerAdapter(AC220 ac220) {
        this.ac220 = ac220;
    }

    @Override
    public int output5V() {
        int adapterInput = ac220.outPutAC220V();
        int adapterOutput = adapterInput / 44;
        System.out.println("使用Adapter输入AC" + adapterInput + "V, 输出DC" + adapterOutput + "V");
        return adapterOutput;
    }

    public int outPutAC220V() {
        return this.ac220.outPutAC220V();
    }


}
